<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
script type="text/javascript" src="<c:url value="/js/jquery-easyui-1.5.5.6/jquery.min.js"/>"></script>
<script type="text/javascript" src="<c:url value="/js/jquery-easyui-1.5.5.6/jquery.easyui.min.js"/>"></script>
<script type="text/javascript" src="<c:url value="/js/jquery-easyui-1.5.5.6/locale/easyui-lang-zh_CN.js"/>"></script>
<link rel="stylesheet" type="text/css" href="<c:url value="/js/jquery-easyui-1.5.5.6/themes/default/easyui.css"/>" />
<link rel="stylesheet" type="text/css" href="<c:url value="/js/jquery-easyui-1.5.5.6/themes/icon.css"/>" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>模板信息</title>
</head>
<body>
	<script type="text/javascript">
		$(function(){
			//返回模板页面
			$("#template_message_return").linkbutton({
				onClick:function(){
					$("#template_message").panel({
						href:"SalaryTable"
					})
				}
			});
			//编辑
			$("#template_message_edit").linkbutton({
				onClick:function(){
					var templateId=${list.templateId};
					$("#template_message").panel({
						href:"transmitTemplate?templateId="+templateId
					})
				}
			});
			//打开弹窗
			$('#template_message_addbacth').linkbutton({
				onClick : function() {
					$("#template_message_dialog").dialog("open");
				}
			});
			//查询薪资项目
			$("#template_message_dialog_submit").linkbutton({
				onClick:function(){
					$('#template_message_dialog_table').datagrid({ url: 'pageSalaryProject?text='+$('#template_message_dialog_id').val()+'&select='+$('#template_message_dialog_name').val()});//重新指定url
					$('#template_message_dialog_table').datagrid('reload'); 
				}	
			});
			//打开添加项目页面
			$("#template_message_addproject").linkbutton({
				onClick:function(){
					$("#template_message_panel").panel({
						href:"Commonsalarytj"
					})
				}
			});
			
		});
	</script>
	<form method="get" id="Tform">
	<div class="easyui-panel" id="template_message" data-options="fit:true,border:false">
	<div style="margin-left: 4px">
		<a href="#" class="easyui-linkbutton" id="template_message_edit" data-options="iconCls:'icon-edit',plain:true,text:'编辑',iconAlign:'left'"></a>|
		<a href="#" class="easyui-linkbutton" id="template_message_return" data-options="iconCls:'icon-back',plain:true,text:'返回',iconAlign:'left'"></a>		
		<div style="font-size:14px;margin-top: 10px,">概要</div>
		<div style="border-top:3px solid #2B91D5;width: 800px;"></div>
		<div style="display:inline-block;width: 800px;margin-left:20px">
			<table cellspacing="15">
				<tbody>
					<tr>
						<td width="80px">*模板编号</td>
						<td width="250px"><span id="templateId" value="${list.templateId }">${list.templateId }</span></td>
						<td width="80px">*模板名称</td>
						<td>${list.templateName }</td>
					</tr>
					<tr>
						<td>*创建时间</td>
						<td>${list.templateCreatordate }</td>
						<td>*创建人</td>
						<td>${list.templatePerson }</td>
					</tr>
				</tbody>
			</table>
		</div>
		<div><span style="font-size:14px">概览</span>  	
			<a href="#" class="easyui-linkbutton" id="template_message_addproject" data-options="plain:true,text:'添加项目',iconAlign:'left'"></a> |
			<a href="#" class="easyui-linkbutton" id="template_message_addbacth" data-options="plain:true,text:'批量添加',iconAlign:'left'"></a>
		</div>		
		<div style="border-top:2px solid #2B91D5;width: 1002px;height:3px;"></div>
		<div style="border:1px solid #2B91D5;width: 1002px;height:420px;margin-top:2px">
			<div style="border:1px solid #2B91D5;width: 300px;height:420px;float:left;">				
				<table class="easyui-datagrid" id="template_message_table" data-options="
						url:'queryRelevanceProject?templateId='+${list.templateId },
						method:'get',
						fitColumns:true,
						fit:true,
						nowrap:false,
						autoRowHeight:true,
						rownumbers:true,
						singleSelect:true,
						striped:true,">
					<thead>
						<tr>
							<th data-options="field:'projectId',width:80,align:'center'">项目编号</th> 
							<th data-options="field:'projectName',width:80,align:'center'">项目名称</th>
							<th data-options="field:'projectSource',width:120,align:'center'">数据来源</th>
						</tr>
					</thead>
					<tbody>
								
					</tbody>
				</table>
			</div>
			<div class="easyui-panel" id="template_message_panel" data-options="border:false" style="border:1px solid #2B91D5;width: 700px;height:422px;">
				
			</div>
		</div>
		<!-- 弹框选择模块 -->
		<div id="template_message_dialog" class="easyui-dialog"
			data-options="
				width:500,
				height:450,
				title:'清单查找-薪资项目',
				modal:true,
				closed:true,
				buttons:[{
					text:'确定',
					handler:function(){
						var row = $('#template_message_dialog_table').datagrid('getSelections');
						$('#Tform').form({
							url:'templateRelevance',
							onSubmit: function(params){
								var j=0;
								for(var i = 0; i < row.length; i ++){
									if(!row[i].children){
										params['projectId['+j+']']=row[i].projectId;
										j++;
									}
								}
								params['templateId'] = $('#templateId').text();
								alert($('#templateId').text());
							},
							success:function(){
								$('#template_message_dialog').dialog('close');
								$('#template_message_dialog_table').datagrid('clearChecked',{});
								$('#template_message_table').datagrid('reload'); 
							}
						}).submit();
					}
				},{
					text:'取消',	
					handler:function(){
						$('#template_message_dialog_table').datagrid('clearChecked',{});
						$('#template_message_dialog').dialog('close');
					}
				}]">
	
			<div id="template_message_dialog_toolbar" style="background:#CEDEFA;padding-left: 20px;">
				<input class="easyui-textbox" id="template_message_dialog_id" data-options="label:'项目编号：',width:220,labelWidth:80" />
				<button class="easyui-linkbutton" data-options="text:'模糊搜索'"></button><br>
				<input class="easyui-textbox" id="template_message_dialog_name"  data-options="label:'项目名称：',width:220,labelWidth:80" style="margin-top: 2px"/>
				<button class="easyui-linkbutton" id="template_message_dialog_submit" data-options="text:'搜索',width:60"></button>
			</div>
			<table id="template_message_dialog_table" class="easyui-datagrid"
					data-options="
						pagination:true,
						pageSize:15,
						pageList:[5,10,15,20,25],
						url:'lzs_SalaryProjectfindAll',
						method:'get',
						fitColumns:true,
						fit:true,
						nowrap:false,
						autoRowHeight:true,
						rownumbers:true,
						striped:true,
						toolbar:'#template_message_dialog_toolbar'">
				<thead>
					<tr>
						<th data-options="field:'projectId',width:50">编号</th>
						<th data-options="field:'projectName',width:50">项目名称</th>
						<th data-options="field:'projectSource',width:50">数据来源</th>
						<th data-options="field:'projectPerson',width:50,checkbox:true"></th>
					</tr>
				</thead>
				<tbody>
					
				</tbody>
			</table>
		</div>
	</div>
	</div>
	</form>
</body>
</html>